Câu ví dụ
- thêm câu ví dụ: 1 2 3 4 5
- Conditional Expression (or "The Ternary Operator")
Biểu thức điều kiện ?: (hay còn gọi là “Ternary Operator”) - Finally, a conditional expression appends "P.M." to temp if hour is 12 or greater; otherwise, it appends "A.M." to temp.
Cuối cùng, chèn "P.M" vào temp nếu hour lớn hơn 12, ngược lại ta chèn "A.M.". - Expression 2 is a conditional expression.
Biểu thức 2 là một biểu thức điều kiện - When the conditional expression is absent, it is assumed to be true.
Khi biểu thức điều kiện vắng mặt, nó được giả sử là luôn đúng. - Replace conditional expression with function
Thay biểu thức điều kiện bằng function